"use strict";
cc._RF.push(module, '48b69XZILlEzJX3Tl7x6Yp8', 'TimeUtil');
// eazax-ccc/utils/TimeUtil.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 时间工具
 * @see TimeUtil.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/utils/TimeUtil.ts
 */
var TimeUtil = /** @class */ (function () {
    function TimeUtil() {
    }
    /**
     * 获取当前时间戳
     * @example
     * TimeUtil.getTimestamp(); // 1614616955186
     */
    TimeUtil.getTimestamp = function () {
        return new Date().getTime();
    };
    /**
     * 获取当前日期（年/月/日）
     * @example
     * TimeUtil.getDate(); // "2021/3/2"
     */
    TimeUtil.getDate = function () {
        return new Date().toLocaleDateString();
    };
    /**
     * 获取当天指定时间的时间戳
     * @param hour 时
     * @param minute 分
     * @param second 秒
     * @example
     * const time = TimeUtil.getTargetTimestamp(10, 20, 30); // 1601259630000
     * new Date(time).toLocaleString(); // "上午10:20:30"
     */
    TimeUtil.getTargetTimestamp = function (hour, minute, second) {
        if (hour === void 0) { hour = 0; }
        if (minute === void 0) { minute = 0; }
        if (second === void 0) { second = 0; }
        var start = new Date(new Date().toLocaleDateString()).getTime();
        var target = ((hour * 3600) + (minute * 60) + second) * 1000;
        return new Date(start + target).getTime();
    };
    /**
     * 将毫秒转为时分秒的格式（最小单位为秒，如："00:01:59"）
     * @param time 毫秒数
     * @param separator 分隔符
     * @param keepHours 当小时数为 0 时依然展示小时数
     * @example
     * TimeUtil.msToHMS(119000); // "00:01:59"
     */
    TimeUtil.msToHMS = function (time, separator, keepHours) {
        if (separator === void 0) { separator = ':'; }
        if (keepHours === void 0) { keepHours = true; }
        var hours = Math.floor(time / 3600000);
        var minutes = Math.floor((time - (hours * 3600000)) / 60000);
        var seconds = Math.floor((time - (hours * 3600000) - (minutes * 60000)) / 1000);
        var hoursString = (hours === 0 && !keepHours) ? '' : hours.toString().padStart(2, '0') + ":";
        return "" + hoursString + minutes.toString().padStart(2, '0') + separator + seconds.toString().padStart(2, '0');
    };
    return TimeUtil;
}());
exports.default = TimeUtil;

cc._RF.pop();